﻿// Learn morcabut F# at http://fsharp.netnewE
// See the 'F# Tutorial' project for more help.

open System

[<AutoOpen>]
module ConsoleReader =
    let readLine = System.Console.ReadLine
    let readInt() = int (readLine())

module Minesweeper =
    let round (x:float) = Math.Round(x)

    let readInput() =   
        let line = readLine().Split() |> Array.map (fun x -> int x)
        match line with
        | [|x1;x2;x3|] -> x1, x2, x3
        | _ -> raise (new ArgumentException())

    let rec solve (R, C, M) =
        let nbOfCells = R * C
        let root = int (Math.Sqrt(float nbOfCells))
        "Impossible"

    let solveCase() =
        readInput() |> solve

    let solveCases nbOfCases =
        for i=1 to nbOfCases do
            printfn "Case #%d" i
            printfn "%s" (solveCase())

[<EntryPoint>]
let main argv = 
    let nbOfCases = readInt()

    Minesweeper.solveCases nbOfCases

    0 // return an integer exit code
